/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entitybean;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Admin
 */
@Entity
@Table(name = "producers", catalog = "OnlineShopFourDVD", schema = "dbo")
@NamedQueries({
    @NamedQuery(name = "Producers.findAll", query = "SELECT p FROM Producers p"),
    @NamedQuery(name = "Producers.findByProducerId", query = "SELECT p FROM Producers p WHERE p.producerId = :producerId"),
    @NamedQuery(name = "Producers.findByName", query = "SELECT p FROM Producers p WHERE p.name = :name"),
    @NamedQuery(name = "Producers.findByOtherInfo", query = "SELECT p FROM Producers p WHERE p.otherInfo = :otherInfo")})
public class Producers implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "producer_id", nullable = false)
    private Integer producerId;
    @Column(name = "name", length = 50)
    private String name;
    @Column(name = "other_info", length = 200)
    private String otherInfo;
    @OneToMany(mappedBy = "producers")
    private Collection<Media> mediaCollection;

    public Producers() {
    }

    public Producers(Integer producerId) {
        this.producerId = producerId;
    }

    public Integer getProducerId() {
        return producerId;
    }

    public void setProducerId(Integer producerId) {
        this.producerId = producerId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getOtherInfo() {
        return otherInfo;
    }

    public void setOtherInfo(String otherInfo) {
        this.otherInfo = otherInfo;
    }

    public Collection<Media> getMediaCollection() {
        return mediaCollection;
    }

    public void setMediaCollection(Collection<Media> mediaCollection) {
        this.mediaCollection = mediaCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (producerId != null ? producerId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Producers)) {
            return false;
        }
        Producers other = (Producers) object;
        if ((this.producerId == null && other.producerId != null) || (this.producerId != null && !this.producerId.equals(other.producerId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entitybean.Producers[producerId=" + producerId + "]";
    }

}
